qx.Class.define("ui.view.PageNews", {
			events : {
				"reloadNews" : "qx.event.type.Event",
				"postNews" : "qx.event.type.Data",
				"deleteNews" : "qx.event.type.Data"
			},
			extend : qx.ui.tabview.Page,
			construct : function() {
				this.base(arguments);
				this.setLabel("Noticias");
				var layout = new qx.ui.layout.Grid();
				this.setLayout(layout);
				var toolbar = new qx.ui.toolbar.ToolBar();
				this.add(toolbar, {
							column : 0,
							row : 0
						});
				layout.setColumnFlex(0, 1);
				var reloadButton = new qx.ui.toolbar.Button("Recargar");
				var addButton = new qx.ui.toolbar.Button("Agregar");
				var removeButton = new qx.ui.toolbar.Button("Eliminar");

				toolbar.add(reloadButton);
				toolbar.add(addButton);
				toolbar.add(removeButton);
				reloadButton.addListener("execute", function() {
							this.fireEvent("reloadNews");
						}, this);
				this.initForm();
				//this.add(this.formRenderer, {
				//			column : 0,
				//			row : 1
				//		})
				layout.setColumnFlex(1, 1);

				this.__list = new qx.ui.form.List();
				this.add(this.__list, {
							column : 0,
							row : 2
						});

			},
			members : {
				__form : null,
				getForm : function (){
					return this.__form;
				},
				initForm : function() {
					this.__form = new qx.ui.form.Form();
					var username = new qx.ui.form.TextField();
					username.setRequired(true);
					this.__form.add(username, "Username", null, "username");

					var password = new qx.ui.form.PasswordField();
					password.setRequired(true);
					this.__form.add(password, "Password", null, "password");

					var controller = new qx.data.controller.Form(null, this.getForm());
					var model = controller.createModel();

					var loginbutton = new qx.ui.form.Button("Login");
					this.__form.addButton(loginbutton);

					var cancelbutton = new qx.ui.form.Button("Cancel");
					this.__form.addButton(cancelbutton);
					cancelbutton.addListener("execute", function() {
								this.getForm().reset();
							}, this);

					this.formRenderer = new qx.ui.form.renderer.Single(this.getForm());
					/*loginbutton.addListener("execute", function() {
								if (this.__form.validate()) {
									var loginData = {
										username : controller.getModel()
												.getUsername(),
										password : controller.getModel()
												.getPassword()
									};
									this.fireDataEvent("changeLoginData",
											loginData);
									// this.close();
								}
							}, this);*/

					/*
					this.addListener("changeLoginData", function(ev) {
								var loginData = ev.getData();
								service.login(loginData.username,
										loginData.password, this.yes, function(
												causa) {
											alert(causa);
											this.getForm().reset();
										}, this);

							}, this);*/
					
				},
				getList : function() {
					return this.__list;
				}
			}

		});